package com.mzj.saas.mservice.sys.controller;

import com.mzj.saas.commons.ResultBean;
import com.mzj.saas.mservice.sys.service.MessageUserService;
import com.mzj.saas.mservice.sys.vo.MessageTypeVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


/*
 *消息推送人员设置
 */
@Controller
@RequestMapping("/messageUser")
@Api("消息推送人员设置")
public class MessageUserController {

    @Autowired
    private MessageUserService messageUserService;

    /**
     * 列表
     * @return
     */
    @RequestMapping(value = "/list", method = RequestMethod.POST)
    @ResponseBody
    public ResultBean<Object> list(@RequestHeader String accessToken, @RequestParam(defaultValue = "0") Integer pageNumber,
                                   @RequestParam(defaultValue = "10") Integer pageSize) {
        return messageUserService.list(accessToken, pageNumber, pageSize);
    }

    /*
     *新增推送人员
     */
    @PostMapping("/save")
    @ResponseBody
    public ResultBean<Object> save(@RequestHeader String accessToken, @RequestParam(name = "userId", required = false) String userId) {
        return messageUserService.save(accessToken, userId);
    }

    /*
     *删除推送人员
     */
    @PostMapping("/delete")
    @ResponseBody
    public ResultBean<Object> delete(@RequestHeader String accessToken, @RequestParam(name = "userId", required = false) String userId) {
        return messageUserService.delete(accessToken, userId);
    }

    /*
     *新增推送人员,可选择推送内容
     */
    @PostMapping("/saveType")
    @ResponseBody
    @ApiOperation("新增推送人员,可选择推送内容")
    public ResultBean<Object> saveType(@RequestHeader String accessToken, @RequestBody MessageTypeVo messageTypeVo) {
        return messageUserService.saveType(accessToken, messageTypeVo);
    }
}
